import 'package:flutter/src/widgets/framework.dart';
import 'package:xsdk_flutter/xsdk/framework/base/xsdk_function.dart';
import 'package:xsdk_flutter/xsdk/framework/base/xsdk_widget_stateful.dart';
import 'package:xsdk_flutter/xsdk/utils/x_utils_color.dart';
import 'package:xsdk_flutter/xsdk/utils/x_utils_image.dart';
import 'package:xsdk_flutter/xsdk/utils/x_utils_widget.dart';

class XStateSearchBarDelWidget extends XState{

  XFunctionWidgetOnClick onclick;

  XStateSearchBarDelWidget({
    required this.onclick
  });

  @override
  Widget onBuild(BuildContext context) {
    return widget.xTempValue1!=true?XWidgetUtils.getLayoutContainer():XWidgetUtils.getWidgetGestureDetector(
        child: XWidgetUtils.getLayoutPadding(
            padding: XWidgetUtils.getEdgeInsets(10, 5,10, 5),
            child: XImageUtils.getImageWidgetWithAsset(
                'x_del.png',
                width: 15,
                height: 15,
                color: XColorUtils.colorCCCCCC
            )
        ),
        onTap: (){
          setState(() {
            widget.xTempValue1=false;
            onclick('');
          });

        }
    );
  }

  @override
  void onCreate() {
  }

  @override
  void onDestroy() {
  }

  @override
  void onStart() {
  }

  @override
  Future<void> updateData({int pageIndex = 1}) async {
  }

  //更新
  void showDelWidget(bool isShow){
    setState(() {
      widget.xTempValue1=isShow;
    });
  }

}